#ifndef RECURSIVE_PACKAGE_H
#define RECURSIVE_PACKAGE_H

#include "package_surpport.h"
#include "scope_array.h"
#include "i_package_codec.h"

Package(RecursivePackage)
{
	scoped_array<char> buf_;
public:
	scoped_array<char>& getBuffer()
	{
		return buf_;
	}

	virtual void handle(IIoHandler::Ptr ioHandler);
	virtual void preSend(IIoHandler::Ptr ioHandler);
	void serialOut(IPackage& package, DuplexCodec& codec);
	void serialOut(IPackage& package);
	IPackage::Ptr serialIn(DuplexCodec& codec) const;

	static void send(IPackage& package, IIoHandler::Ptr ioHandler);

	SurpportPktSerializing(buf_)
};

#endif